package cn.stylefeng.guns.modular.business.frequency.transportreserve.controller;

import cn.stylefeng.guns.core.annotion.BusinessLog;
import cn.stylefeng.guns.core.enums.LogAnnotionOpTypeEnum;
import cn.stylefeng.guns.core.pojo.response.ResponseData;
import cn.stylefeng.guns.core.pojo.response.SuccessResponseData;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import cn.stylefeng.guns.modular.business.frequency.transportreserve.service.TransportReserveService;
import cn.stylefeng.guns.modular.business.frequency.transportreserve.model.param.TransportReserveParam;

import javax.annotation.Resource;

/**
 * 订单承运装车表 控制器
 *
 * @author: yujie
 * @date: 2023/05/09 17:15
 */
@RestController
public class TransportReserveController {

    @Resource
    private TransportReserveService transportReserveService;

    /**
     * 分页查询订单承运装车表
     *
     * @author yujie
     * @date 2023/05/09 17:15
     */
    @GetMapping("/transportReserve/page")
    @BusinessLog(title = "订单承运装车表_分页查询", opType = LogAnnotionOpTypeEnum.QUERY)
    public ResponseData page(TransportReserveParam transportReserveParam) {
        return new SuccessResponseData(transportReserveService.page(transportReserveParam));
    }

    /**
     * 获取全部订单承运装车表
     *
     * @author yujie
     * @date 2023/05/09 17:15
     */
    @GetMapping("/transportReserve/list")
    @BusinessLog(title = "订单承运装车表_查询所有", opType = LogAnnotionOpTypeEnum.QUERY)
    public ResponseData list(TransportReserveParam transportReserveParam) {
        return new SuccessResponseData(transportReserveService.list(transportReserveParam));
    }

    /**
     * 查看详情订单承运装车表
     *
     * @author yujie
     * @date 2023/05/09 17:15
     */
    @GetMapping("/transportReserve/detail")
    @BusinessLog(title = "订单承运装车表_查看详情", opType = LogAnnotionOpTypeEnum.DETAIL)
    public ResponseData detail(@Validated(TransportReserveParam.detail.class) TransportReserveParam transportReserveParam) {
        return new SuccessResponseData(transportReserveService.detail(transportReserveParam));
    }

    /**
     * 添加订单承运装车表
     *
     * @author yujie
     * @date 2023/05/09 17:15
     */
    @PostMapping("/transportReserve/add")
    @BusinessLog(title = "订单承运装车表_增加", opType = LogAnnotionOpTypeEnum.ADD)
    public ResponseData add(@RequestBody @Validated(TransportReserveParam.add.class) TransportReserveParam transportReserveParam) {
        transportReserveService.add(transportReserveParam);
        return new SuccessResponseData();
    }

    /**
     * 删除订单承运装车表
     *
     * @author yujie
     * @date 2023/05/09 17:15
     */
    @PostMapping("/transportReserve/delete")
    @BusinessLog(title = "订单承运装车表_删除", opType = LogAnnotionOpTypeEnum.DELETE)
    public ResponseData delete(@RequestBody @Validated(TransportReserveParam.delete.class) TransportReserveParam transportReserveParam) {
        transportReserveService.delete(transportReserveParam);
        return new SuccessResponseData();
    }

    /**
     * 编辑订单承运装车表
     *
     * @author yujie
     * @date 2023/05/09 17:15
     */
    @PostMapping("/transportReserve/edit")
    @BusinessLog(title = "订单承运装车表_编辑", opType = LogAnnotionOpTypeEnum.EDIT)
    public ResponseData edit(@RequestBody @Validated(TransportReserveParam.edit.class) TransportReserveParam transportReserveParam) {
        transportReserveService.edit(transportReserveParam);
        return new SuccessResponseData();
    }


}
